from rest_framework.decorators import api_view, permission_classes, authentication_classes

from common.exceptions import BusinessException
from common.response import R


@api_view(["GET", "POST"])
@permission_classes([])
@authentication_classes([])
def alive(request, *args, **kwargs):
    if request.query_params.get("raise"):
        raise BusinessException("抛出异常")
    return R.success({}, message="application is alive")


